Methods and apparatus for determining chemical composition of reservoir fluids

ABSTRACT

Methods of analyzing formation fluids in an oilfield environment are near-infrared absorption spectroscopy. Indications of near-infrared absorptions are analyzed to determine the concentration of compounds in a formation fluid sample.

[0001] The present application is a continuation-in-part of and claimspriority from co-pending U.S. application Ser. No. 09/741,575, filed onDec. 19, 2000, which is incorporated herein by reference in itsentirety.

BACKGROUND

[0002] Optical analyses of fluids are well known, and various opticaland spectroscopic techniques have been applied in oilfield environmentsto analyze formation fluids, including gases and condensates. Forexample, U.S. Pat. No. 4,994,671 to Safinya et al. describes anapparatus and method for analyzing the composition of formation fluids.Formation fluids are drawn into a testing region and analyzed bydirecting light at the fluids and detecting the spectrum of transmittedand/or scattered light. The detected spectra are fit to spectra of knowncomposition to determine the composition of the fluid sample. U.S. Pat.No. 5,266,800 to Mullins and U.S. Pat. No. 5,331,156 to Hines et al.describe applying optical density measurements to distinguish betweencrude oils and to analyze water and oil fractions, respectively, in,e.g., a formation flow stream obtained by a borehole tool. U.S. Pat. No.5,167,149 to Mullins et al. and U.S. Pat. No. 5,201,220 to Mullins etal. describe a method and apparatus that involve transmitting lighttowards a fluid in a flow line and detecting reflected light at variousangles of incidence. Information related to the Brewster angle andcritical angle of known gas volumes of formation fluids is used tocategorize the fluid in the flow line as high gas, medium gas, low gas,and no gas. U.S. Pat. No. 5,859,430 to Mullins et al. describes aborehole tool and method for the downhole analysis of formation gases.When substantial amounts of gas are detected in a fluid stream, thefluid stream is diverted into a sample cell. The gaseous fluid sample isanalyzed by directing light to the sample cell and detecting absorbancespectra. The detected spectra are fit to known spectra of varioushydrocarbons in order to obtain information regarding the hydrocarboncomposition in the gas stream.

[0003] U.S. Pat. No. 4,994,671, U.S. Pat. No. 5,266,800, U.S. Pat. No.5,331,156, U.S. Pat. No. 5,167,149, U.S. Pat. No. 5,201,220, and U.S.Pat. No. 5,859,430 are each incorporated by reference herein in theirentireties.

SUMMARY OF INVENTION

[0004] The invention provides methods of providing a chemicalcompositional analysis while sampling a formation fluid in an oilfieldenvironment The method involves extracting a formation fluid sample,transmitting near-infrared light through the formation fluid sample, anddetecting indications of near-infrared absorptions from the formationfluid sample. The indications of near-infrared absorptions are analyzed,and the concentrations of a plurality of compounds in the formationfluid sample are determined.

[0005] Further details and features of the invention will become morereadily apparent from the detailed description that follows.

BRIEF DESCRIPTION OF FIGURES

[0006] The invention will be described in more detail below inconjunction with the following Figures, in which:

[0007]FIG. 1 illustrates a borehole apparatus for analyzing formationfluids that may be used to implement certain embodiments of theinvention;

[0008]FIG. 2 shows a schematic diagram of a fluid analysis module thatcan be used in conjunction with a borehole apparatus, such as that shownin FIG. 1, in implementing certain embodiments of the invention;

[0009]FIG. 3 shows a schematic diagram of one embodiment of a gasmeasurement cell that can be used in conjunction with a fluid analysismodule, such as that shown in FIG. 2;

[0010]FIG. 4 shows the near-infrared absorption spectra of methane,carbon dioxide, and a 50:50 mixture by mass thereof taken at highpressure;

[0011]FIG. 5 contains a graph showing a correlation between fractionalpeak area and carbon dioxide mass fraction in a carbondioxide-hydrocarbon mixture;

[0012]FIG. 6 shows the steps to set up a principal component regressionmodel in accordance with one embodiment of the invention;

[0013]FIG. 7 contains 19 examples of calibration spectra that may beused in some embodiments of the invention;

[0014]FIG. 8 contains spectra of five principal components of thecalibration spectra shown in FIG. 7; and

[0015]FIG. 9 shows the steps of providing a chemical compositionalanalysis in an oilfield environment according to one embodiment of theinvention.

DETAILED DESCRIPTION

[0016] In general, the invention involves the use of near-infrared (NIR)absorption spectroscopy to analyze the chemical composition of areservoir fluid sample, in some cases in a downhole environment or underdownhole conditions. The fraction of light absorbed per unit path lengthin a fluid sample depends on the composition (i.e., the identity and theconcentration, or amount, of the constituent compounds) of the sampleand the wavelength of the light Thus, the amount of absorption as afunction of wavelength of light, hereinafter referred to as an“absorption spectrum”, has been used in the past as an indicator offluid composition. The present invention extends the use of NIRabsorption spectroscopy to provide, in real-time, a more detailedanalysis of formation fluids.

[0017] As applied to a downhole environment, the methods of theinvention would be implemented using a borehole tool. FIG. 1 illustratesa borehole apparatus that may be used in implementing certainembodiments of the invention. The invention is applicable to bothproduction logging and to borehole investigative logging; someembodiments also are useful for general monitoring of subsurfaceformations. For purposes of brevity, however, the description hereinwill be primarily directed to borehole investigative logging, and theterms “borehole” and “borehole tool” should be read throughout thespecification and claims to all such environments and evaluation toolsused in such environments. Also, the term “sampling” should be readbroadly to encompass any sampling of a formation fluid in an oilfieldenvironment, such as from a subsurface formation or a production flowline.

[0018]FIG. 1 shows a borehole tool 10 for testing earth formations andanalyzing the compositions of fluids from the formation 14 in accordwith the invention. As illustrated, the tool 10 is suspended in theborehole 12 from the lower end of a typical multiconductor cable 15 thatis spooled in a usual fashion on a suitable winch (not shown) on theformation surface. On the surface, the cable 15 is preferablyelectrically coupled to an electrical control system 18. The tool 10includes an elongated body 19 that encloses the downhole portion of thetool control system 16. The elongated body 19 also carries a selectivelyextendable fluid admitting assembly 20 and a selectively extendabletool-anchoring member 21 that are respectively arranged on oppositesides of the body. The fluid admitting assembly 20 is equipped forselectively sealing off or isolating selected portions of the wall ofborehole 12 such that pressure or fluid communication with the adjacentearth formation is established. Also included within the tool 10 is afluid analysis module 25 through which the obtained fluid flows. Thefluid may thereafter be expelled through a port (not shown) or it may besent to one or more fluid collecting chambers 22 and 23, which mayreceive and retain the fluids obtained from the formation. Control ofthe fluid admitting assembly, the fluid analysis section, and the flowpath to the collecting chambers is maintained by the electrical controlsystems 16 and 18.

[0019] Additional details of methods and apparatus for samplingformation fluids may be had by reference to U.S. Pat. No. 3,859,851 toUrbanosky and U.S. Pat. No. 4,396,259 to Miller, which are incorporatedby, reference herein. It should be appreciated, however, that theinvention is not intended to be limited to any particular method orapparatus for obtaining the formation fluids.

[0020] Turning to FIG. 2, a schematic diagram is seen of one embodimentof a fluid analysis module 25 of FIG. 1. As seen in FIG. 2, the fluidanalysis module 25 includes an optical fluid analyzer 30, a flowdiverter 35 with associated control line 38, a gas measurement cell 40,optional gas sample chambers 42 a and 42 b with associated valves 43 a,43 b and control lines 44 a, 44 b, and gas and fluid flow lines 45 a, 45b, 45 c, 45 d, and 45 e. The optical fluid analyzer 30, which receivesfluids from the borehole and formation via fluid flow line 45 a may bean analyzer such as shown and described in previously incorporated U.S.Pat. No. 4,994,671 to Safinya et al., U.S. Pat. No. 5,167,149 to Mullinset al., U.S. Pat. No. 5,201,220 to Mullins et al., U.S. Pat. No.5,266,800 to Mullins et al., and U.S. Pat. No. 5,331,156 to Hines et al.Thus, the optical fluid analyzer 30 is capable of distinguishing betweenoil, water, and gas, and as set forth in U.S. Pat. No. 5,167,149 toMullins et al., and U.S. Pat. No. 5,201,220 to Mullins et al., iscapable of categorizing the fluid sample as high gas, medium gas, lowgas, and no gas. When the fluid sample contains oil or water, the fluidsample is either optionally stored in sample fluid chambers (not shown),or expelled back into the borehole via fluid flow lines 45 b and 45 c.

[0021] Upon determining that the fluid sample has a high gas content,the fluid analyzer 30 provides a control signal via control line 38 tothe flow diverter 35 which diverts the fluid sample via flow line 45 dto the gas measurement cell 40 for analysis. While the flow diverter 35can take many forms, preferably, it is simply embodied as anelectronically controlled 2-way valve. After passing through the gasmeasurement cell 40, the gas may be sent to one or more gas samplechambers 43 a, 43 b, for storage. Valves 43 a, 43 b under control of thegas measurement cell 40 via control lines 44 a, 44 b are provided forthat purpose. Alternatively, the gas may be passed via fluid flow line45 e back to fluid flow line 45 c for the purpose of being expelled backinto the borehole. If desired, backflow or check valves (not shown) maybe provided to prevent borehole fluids from backing back into flow line45 d.

[0022]FIG. 3 shows details of one embodiment of the gas measurement cell40 which is seen to include a light source 52, a fiber optic bundle(s)54 (with portions 54 a, 54 b 1, 54 b 2, 54 c 1, 54 c 2, 54 d 1, 54 d 2,54 e 1 and 54 e 2), a variable path length vessel 60, including portions60 a, 60 b, and 60 c, a photo-detector means 68, and a known sample 72.As indicated, gas received via control line 45 d is provided to thevessel 60 which includes portion 60 a having a 2 mm path length (width),portion 60 b having a 4 mm path length, and portion 60 c having a 10 mmpath length. The vessel 60 includes windows (not shown) through whichthe light is directed. The light is obtained from the light source 52,which provides light in the near infrared spectrum. The light source 52may be a narrow bandwidth light emitting diode (LED) or laser, or abroadband source, such as a tungsten halogen lamp, incandescent lamp, orthe like, used in conjunction with an optical filter 78 to filter outlight of other wavelengths. It should be noted that the light source 52may reside within the cell within the borehole tool as shown in FIG. 1,or at the surface, with the light from the light source being carrieddownhole to the cell through optical fibers. Regardless, light from thelight source 52 is carried via optical fibers 54 b 1, 54 c 1, and 54 d 1to the vessel 60, and light emerging from the vessel is carried byoptical fibers 54 b 2, 54 c 2, and 54 d 2 to the photo-detector means68, which may reside within the cell as shown or at the surface. Thephoto-detector means 68 may include several arrays of photo-detectorstuned to different frequencies of interest, or a single broadbandphoto-detector with a filter wheel, which permits a time divisionmultiplexed determination of the frequency spectrum of the sampleflowing through the vessel. Furthermore, it will be appreciated that,the light emerging from each of the portions 60 a, 60 b, and 60 c may besensed by different sets of photo-detectors, or as shown in FIG. 3, maybe time division multiplexed to a single set of the photo-detectorsthrough an aperture 81 which moves in conjunction with the entirephoto-detector means 68. If desired, pressure sensing means may beprovided for controlling which optical information is provided to thephoto-detectors, as the cell portion having an appropriate path lengthfor sensing the gas and providing a reading in a desired range willoften be a function of pressure; i.e., the gas density (and henceabsorbance per unit path length) varies as a function of pressure. Inany event, it is generally preferable that the light provided to thephoto-detector means 68 via fibers 54 b 2, 54 c 3, and 54 d 2 beseparately sensed, because where the density of the gas is low, thelight emerging from sample portion 60 c may provide a desirable signal,but the light emerging from sample portion 60 a will be too large andwill not permit an appropriate analysis.

[0023] As previously mentioned, light from the light source is alsocarried by fibers 54 a for detection by the photo-detector means 68, andby fibers 54 e 1 to the known reference sample 72, and from thereference sample by fibers 54 e 2 to the photo-detector means 68. Theprovision of fibers 54 a for carrying light directly to thephoto-detector means 68 is known in the art, and is used to cancel driftin the light source, detector, and electronics in order to provide amore robust spectral measurement. The provision of a third path throughthe known sample 72, however, permits compensation for shifts in actualabsorption peak locations or shifts in optical filter wavelengths,yielding an even more robust determination of sample properties in thedownhole environment. With the known sample, shifts in detectedabsorption peak wavelengths or shifts in optical filter wavelengths canbe easily determined, thus permitting a relatively straightforwardcompensation for the unknown sample being analyzed.

[0024] Individual absorption peaks may be detected using a broadbandlight source in conjunction with narrow band filters centered at theselected wavelengths, with the narrow band filters being placed eitherat the light source, to filter the light before being transmittedthrough the formation gas, or at the detector, to filter the light afterbeing transmitted through the formation gas. Alternatively, a pluralityof narrow band light sources, each producing a narrow band ofnear-infrared light centered at a selected wavelength, may be used.

[0025] Other embodiments and additional details of the gas measurementcell 40 are shown and described in previously incorporated U.S. Pat. No.5,859,430 to Mullins et al. Some embodiments of the present inventionuse NIR absorption spectroscopy to detect the presence (or absence) ofcarbon dioxide in downhole environments, or to distinguish carbondioxide from a hydrocarbon, such as methane, in formation fluids. FIG. 4shows the near-infrared absorption spectra of methane, carbon dioxideand a 50-50 mass mixture of methane and carbon dioxide from about 1550nm to about 2100 nm. These absorption spectra show optical density,which is a logarithmic scale measure of the ratio of incident light tolight transmitted through the sample, plotted as a function ofwavelength. An optical density of zero means that all the incident lightat that wavelength is transmitted through the sample and none absorbed,and an optical density of one means that about 90% of the incident lightat that wavelength is absorbed.

[0026] The absorption spectrum of methane (CH₄) shows numerousabsorption peaks between about 1600 nm and about 1900 nm, with a largepeak at about 1670 nm. The absorption spectrum of carbon dioxide (CO₂)shows very little spectral structure in this region and large absorptionpeaks at about 1960 nm, 2010 nm, and 2060 nm. The absorption spectrum ofthe 50-50 mixture shows a combination of spectral features of themethane and carbon dioxide spectra, with essentially no alteration ofthe wavelengths of the absorption peaks resulting from mixing the twogases. The peak at about 1900 nm is believed to be a spurious waterabsorption; as can be seen from FIG. 4, this spurious peak does notinterfere with either the methane or the carbon dioxide absorptions andgenerally does not affect the optical analyses of the inventiondiscussed below.

[0027] The spectra shown in FIG. 4 were taken under about 6000 psi ofpressure and at room temperature. While the spectral features ofabsorption spectra of gases generally vary with temperature andpressure, at pressures above about 1000 psi, the absorption spectra ofCH₄, CO₂, and mixtures thereof lose their ro-vibrational structure andthe spectral features lose explicit dependence on temperature andpressure.

[0028] Optical density is a function of sample density and hence willvary with pressure for gaseous samples, but varying the path length ofthe light through the gaseous sample (as discussed above) can helpcompensate for the effects of pressure on optical density. Thus, thespectra of FIG. 4 indicate that absorption spectra acquired in downholeenvironments, where pressures can reach 20,000 psi and temperatures canreach over 200° C., can be used to detect carbon dioxide and todistinguish between carbon dioxide and methane.

[0029] One embodiment provides methods of detecting the presence (orabsence) of carbon dioxide in downhole environments. Carbon dioxide iscommonly found, and used, in downhole environments. For example, carbondioxide may be injected into a subsurface formation to facilitate theflow of oil from the formation to a producing well in an enhanced oilrecovery operation, and breakthrough of carbon dioxide into theproducing well would be important to detect. In another example, carbondioxide, a greenhouse gas, may be sequestered in a subsurface formationto remove it from the atmosphere, and carbon dioxide leakage from thesubsurface formation would need to be monitored. In such cases, anevaluation tool as described above with respect to FIG. 1, whichextracts a sample of formation fluid from the formation into the toolfor optical analysis, may be used. Alternatively, an evaluation tool maybe injected into a flowing stream of formation fluid, e.g., into theproduction stream flowing in a production well, and optical analysesperformed directly on the flowing stream without drawing the fluid intothe tool.

[0030] Regardless of whether the evaluation tool extracts a sample offormation fluid from the formation or is injected into a flowing streamof formation fluid, when a gas is detected in the formation fluid (e.g.,using the methods described in U.S. Pat. Nos. 5,167,149 and 5,201,220),near-infrared light is transmitted through the formation fluid, andindications of near-infrared absorption are detected from the formationfluid. In one embodiment, the indications of near-infrared absorptionare detected over narrow band(s) centered at one or more wavelengthswhere carbon dioxide is known to absorb. As seen in the spectra of FIG.4, carbon dioxide has strong absorption peaks at about 1960 nm, about2010 nm, and about 2060 nm, and the presence (or absence) of carbondioxide in the formation gas may be detected using any one or more ofthese known absorption wavelengths. Other known carbon dioxideabsorption peaks may be used, though the detection wavelength typicallyis selected to not overlap with any methane or other formation fluidabsorptions. Indications of near-infrared absorption typically also aredetected at a wavelength at which neither carbon dioxide nor otherformation fluid absorbs in order to determine a baseline from which thecarbon dioxide absorption is measured.

[0031] Another embodiment provides a method of distinguishing betweencarbon dioxide and methane in a downhole environment The presence ofcarbon dioxide in hydrocarbon production may prove problematic for anumber of reasons. When present in natural gas, carbon dioxide reducesthe BTU content of the gas, making it less economical to produce. Also,if the gas is brought to the surface, carbon dioxide must be separatedfrom the natural gas, which is a costly procedure. It would be desirableto determine the BTU content of produced gas and to identify and shutoff carbon dioxide producing zones before the gas is brought to thesurface. This requires a method to distinguish between carbon dioxideand natural gas, which is primarily methane. As described previously,the indications of near-infrared absorptions may be detected at selectedwavelengths, as opposed to scanning over a broad range of wavelengths.For example, indications of near-infrared absorption may be detected atabout 1960 nm, where carbon dioxide has an absorption peak, and at about1670 nm, where methane has an absorption peak, though other wavelengthsat which carbon dioxide or methane absorbs may be used. To distinguishcarbon dioxide and methane, at least three wavelengths typically areused: a first wavelength at which carbon dioxide absorbs; a secondwavelength at which methane absorbs; and a third wavelength at whichneither carbon dioxide or methane absorbs which is used to determine abaseline from which indications of absorption at the first and secondwavelengths are measured. In one embodiment, spectral analysis may beaccomplished by comparing the intensities of the detected absorptionindications with known absorption spectra from carbon dioxide-methanegas mixtures having different relative mass fractions. The detectedabsorption indications may be fit to the known spectra using, e.g., aleast mean squares fitting, multivariate analysis, etc. In anotherembodiment, the detected absorption indications may be analyzed in termsof fractional peak areas and correlated with mass fraction using knownspectral data. The graph of FIG. 5 illustrates one example of such acorrelation. The carbon dioxide fractional peak area was determined asthe area of the carbon dioxide peak at about 1960 nm (taken over thefull peak width) divided by the sum of peak area of this peak and themethane peak at about 1670 nm (taken over a 25 nm peak width to avoidoverlapping with absorption peaks of other hydrocarbons). The carbondioxide fractional peak area calculated in this fashion shows a nearly1:1 correlation with carbon dioxide mass fraction in the mixture (theslope of the fitted line equals about 1.04). Thus, detected absorptionindications analyzed in this manner provide a direct indication ofcarbon dioxide mass fraction, and, as indicated above, such correlationappears to be relatively independent of sample pressure and temperature.A linear correlation between methane NIR signal and methane massfraction also exists, and those of ordinary skill in the art willrecognize that this analysis may be applied to determine methane massfraction. The methods of the invention as applied to detecting carbondioxide, or distinguishing methane and carbon dioxide, in mixtures ofprimarily methane and carbon dioxide are relatively straightforward andcomputationally simple, and may be implemented in the field to provideanalytical results in real-time, e.g., while sampling the formationfluid downhole.

[0032] These methods also may be extended to measure and analyze NIRspectra of more complex, multi-compound formation fluid mixtures. Theinventors have observed that at pressures above about 1000 psi, which istypical of downhole conditions, NIR spectra of even complex formationfluid mixtures lose any explicit dependence on temperature and pressureand depend linearly on compound mass density only. While theseobservations facilitate the application of the techniques of the presentinvention to downhole spectra of complex formation fluids, NIRabsorption bands of higher hydrocarbons, such as ethane, propane, etc.,may overlap with each other and may interfere with the CO₂ signal,making simple integration of peak area difficult to implement.Alternatively, such multi-compound formation fluid samples may beanalyzed by comparing or fitting the measured NIR absorptions to NIRspectra of known compounds and mixtures, such as in a classical leastsquares model. This type of analysis, however, typically requires eachconstituent compound to be known a priori and, as a result, may requirea large number of reference spectra to be stored and becometime-consuming to implement, making it impractical for real-time,oilfield use. Other types of least squares (e.g., partial least squares,inverted least squares) and multivariate analyses may be used in themethods of the present invention and are described, e.g., in PLS_ToolboxVersion 2.1 handbook, Eigenvector Research, Inc., pp. 75-84 (2000) andDonahue et al., “Near-Infrared Multicomponent Analysis in the Spectraland Fourier Domains: Energy Content of High-Pressure Natural Gas”, Anal.Chem., 1988, vol. 60, pp. 1873-1878, both of which are incorporatedherein in their entireties.

[0033] A presently preferred technique applies a principal componentregression to the formation fluid NIR spectrum. Principal componentregression is a well-known mathematical technique, and has been appliedto multi-compound NIR analysis previously. See, e.g., Malinowski andHowery, Factor Analysis in Chemistry (Wiley, New York, 1980), chap. 2-3.However, prior to the present invention, applying principal componentregression to downhole spectra of complex formation fluids had not beenthought practicable because of the limited spectral data available(typically <10 wavelength channels) from downhole evaluation tools.Embodiments of the present invention provide a way to overcome thisobstacle, as will be described below. In order to avoid confusion in thedescription that follows, the term “compound” shall refer to a chemicalspecies or group in a fluid mixture and the term “component” shall referto an eigenvector used in the principal component analysis.

[0034] Principal component regression reduces the complexity of fittinga multi-compound spectrum to a plurality of reference, or calibration,spectra by analyzing the multi-compound spectrum in terms of theprincipal components of the calibration spectra. FIG. 6 outlines thesteps to set up the principal component regression for field analysis.These steps typically would be completed prior to the actual fieldmeasurement and so would not be part of the real-time compositionalanalysis that occurs in the field.

[0035] Beginning at step 110, a calibration data matrix, D_(t×m), isconstructed from a plurality of calibration spectra. The calibrationspectra typically include spectra of pure formation fluid compounds aswell as known formation fluid mixtures. The calibration data also mayinclude such spectra taken at different temperatures and/or pressures.Each element of the calibration data matrix, D_(t×m), represents a NIRabsorption (e.g., optical density) at one of t wavelengths for one of mcalibration samples (e.g., different compound, mixture, temperature, orpressure). To exactly determine the composition of an unknown mixture,at least as many calibration spectra should be used as constituentcompounds in the mixture, though less specific information may bedetermined using fewer calibration spectra Also, over time, as morecalibration samples and as actual formation fluid samples are analyzed,those spectra may be added to the calibration data matrix. In general,the more calibration data used, the better the results of the principalcomponent analysis (step 115) and of the ultimate chemical compositionalanalysis will be. Thus, the calibration data matrix may be quite large,in some cases containing up to several thousand elements.

[0036] The principal components, or eigenvectors, of the calibrationdata matrix, D_(t×m), are determined at step 115 using eigenanalysis,which results in D_(t×m) being decomposed into two orthogonal matrices,R_(t×s)C_(s×m), where s is the smaller of t or m and represents thenumber of principal components resulting from the eigenanalysis. R_(t×s)contains the absorptions at the t wavelengths of the s principalcomponents, and C_(s×m) contains the scores, or weights, of the scomponents that reproduce the m calibration spectra Some of these scomponents are associated with experimental errors and may be discarded.For a mixture of n compounds, n components can provide a compositionalanalysis of all n compounds, assuming the NIR spectrum is a linearmixture of the constituent compound spectra, which is typically the caseat high pressure (>about 1000 psi), even for complex formation fluidspectra; more than n components may be used to account for non-lineareffects; and fewer than n components may provide useful though lessspecific information, e.g., about overall trends, or when someconstituent compounds have similar spectral features, such as somehigher alkanes. In the description that follows, f will be used todesignate the number of principal components that are retained for usein the downhole analysis. For f<s, the calibration data matrix may beapproximated as D_(t×m)≈D _(t×m)=R _(t×f) C _(f×m).

[0037]FIGS. 7 and 8 help illustrate what happens from step 110 to step115. FIG. 7 shows the NIR calibration spectra of the 19 fluid samplesgiven in Table 1, below. The NIR spectra shown in FIG. 7 include 400wavelength channels between approximately 1550 nm and 2100 μm (theregion between about 1800 nm and about 1950 nm contains no usefulinformation about hydrocarbon fluids or carbon dioxide and has beendiscarded here to reduce the possibility of anomalous absorptionsinterfering with the analysis). In step 110, these calibration spectrawould be used to construct the calibration data matrix, D_(t×m), where,in this case, t=400 and m=19. FIG. 8 shows the spectra of the fivelargest of the 19 principal components that result from an eigenanalysisof the 19 calibration spectra shown in FIG. 7 (step 115).

[0038] Table 1: Composition (in mole %) of Calibration Spectra shown inFIG. 7 C₃—C₅ C₆₊ other Sample CH₄ C₂H₆ alkanes alkanes CO₂ (N₂) 1 75 1015 0 0 0 2 80 15 5 0 0 0 3 88 10 2 0 0 0 4 95 5 0 0 0 0 5 64 12 4 0 20 06 75 10 5 10 0 0 7 45 12 8 15 20 0 8 10 10 10 50 20 0 9 75 0 0 0 25 0 1050 0 0 0 50 0 11 25 0 0 0 75 0 12 90 0 0 10 0 0 13 82 0 0 18 0 0 14 70 00 30 0 0 15 41 0 0 59 0 0 16 78 6 7 2 0 7 17 100 0 0 0 0 0 18 0 0 0 0100 0 19 0 0 0 100 0 0

[0039] The principle components of the calibration spectra may be usedto reconstruct the NIR absorption spectrum of any mixture of thecompounds of the calibration samples. As mentioned above, some principalcomponents are associated with experimental errors and may be discarded,though preferably at least as many principal components as constituentcompounds to be analyzed for are retained for the analysis. In general,the inventors have found that three to five (f=3-5) principal componentsare sufficient to analyze a typical formation fluid spectrum in terms ofthe constituent compounds listed in Table 1; however, other numbers ofprincipal components may be used if desired, for example, to analyze formore constituent compounds, or to account for any non-linear effects.

[0040] The calibration data used for D_(t×m) typically include somespectra generated using laboratory spectrometers, which may have 1000NIR wavelength channels or more (i.e., t≧1000). A typical downholeoptical fluid analyzer, such as described above (see FIGS. 1-3 andaccompanying text), however, will have far fewer channels, typically, atpresent, ≦10, some of which may be reserved for a baseline and/or forother measurements. It had been thought that, with so few wavelengthchannels, not enough information would be available to apply principalcomponent regression to downhole NIR spectra With the presentembodiments, however, the inventors have shown that by selectingwavelength channels at which the variance among the principal components(at least among the f components to be retained for the analysis) isenhanced (step 120), enough information may be captured to successfullyapply principal component regression to downhole spectra. Selectingappropriate wavelength channels may be accomplished a number of ways,such as by maximizing some function (e.g., the product) of theeigenvalues of the calibration data matrix, or by looking at theprincipal component spectra and choosing those wavelengths at which theprincipal components appear to have the most variance. For example, bylooking at the principal component spectra shown in FIG. 8, wavelengthbands centered at about 1650 nm, 1690 nm, 1725 nm, 1760 nm, 1960 nm, and2008 nm appear to capture enough of the relevant information containedin the five principal components and so may be selected for the downholechannels. The number of wavelengths selected (t) will depend on thenumber of channels available, the calibration data, the number ofcompounds to be analyzed for, and the number of principal components tobe used, and so may include other, or additional, or fewer, wavelengthsthan those mentioned above. In general, however, at least as manywavelength channels as principal components retained, and preferablymore, are used in these embodiments.

[0041] Once the wavelength channels for the downhole analyzer are known,a reduced calibration data matrix, D _(t×m), containing only thecalibration data for the t wavelength channels, is decomposed into twoorthogonal matrices, R _(t×f) C _(f×m) (step 125). R _(t×f) contains theabsorptions at the t wavelengths of the f principal components to beused in the downhole analysis, and C _(f×m) contains the scores, orweights, of the f components that approximately reproduce the mcalibration spectra.

[0042] The final step to set up the principal component regression modelfor use in the field involves determining a regression or transformationmatrix that relates the calibration spectra data and the chemicalconcentrations of the compounds in the calibration samples (step 130).The modeling to determine this regression or transformation matrix maybe based on either Beer's law or inverse Beer's law. Beer's law relatesthe amount of light a compound absorbs to the concentration of thecompound and the distance the light travels through the compound.Inverse Beer's law is a mathematical construct that treats compoundconcentration as a function of light absorption. While principalcomponent regression based on inverse Beer's law generally provides morestable results and is presently preferred, in some cases, for example,where sufficient calibration data sets (typically >10) are notavailable, a principal component regression based on (non-inverted)Beer's law may be used. The description that follows is based on inverseBeer's law, but it is to be understood that the present inventionencompasses analyses based on either inverse Beer's law or(non-inverted) Beer's law.

[0043] Under an inverse Beer's law model, the chemical concentration,y^(i), of each constituent compound in each calibration sample isrelated to the scores of the calibration spectra, Cf×m, by a regressionvector, b^(i):

y ^(i) _(1×m) =b ^(i) _(1×f) C _(f×m).

[0044] Vector y^(i) _(1×m) contains the concentrations of the i^(th)constituent compound in the m calibration samples, and vector b^(i)_(1×f) contains factors that relate the concentration of the i^(th)constituent compound to the scores of the f principal components. Thechemical concentrations in each calibration sample are known, and thescores have been determined previously (in step 125), leaving theregression vector as the only unknown. One straightforward way todetermine b^(i) for each compound is by fitting the concentrations,y^(i), to the scores, C _(f×m), using a least squares or other knownfitting technique. Alternatively, b^(i) may be determined using inversematrix techniques, but such methods are more computationally difficultand generally not preferred. Once the regression vector, b^(i), for eachcompound and the matrix of principal components, R _(t×f), are known,the principal component regression model is ready to be used in thefield.

[0045]FIG. 9 outlines the steps according to one embodiment of providinga chemical compositional analysis in an oilfield environment. In step210, a formation fluid sample is extracted, generally using a boreholetool such as those described previously or from a production flow line.After the sample has been extracted, near-infrared light is transmittedthrough the formation fluid sample (step 215). Indications ofnear-infrared absorptions, taken at the pre-determined wavelengthchannels, are detected from the formation fluid sample at step 220. Asdescribed above, these indications may be detected using pluralities ofnarrow band light sources and detectors, or using a broadband lightsource, a broadband detector and a plurality of filters, or combinationsthereof. The indications of near-infrared absorption are analyzed (step225), and concentrations of a plurality of compounds, such as methane,carbon dioxide and a higher (C₂₊) hydrocarbon, in the formation fluidsample are determined (step 230).

[0046] According to one embodiment, the indications of near-infraredabsorptions are analyzed under a principal component regression model.The measured indications of near-infrared absorptions are written as avector, M _(t×1), and multiplied by a pseudo-inverse of R _(t×f) andthen by a regression vector, b^(i) _(1×f), to give the concentration,y^(i) _(1×1), of the i^(th) compound in the formation fluid sample. Thisprocess is repeated for each compound to obtain a chemical compositionalanalysis of the formation fluid sample. In applying the principalcomponent regression model in the field, only information about theplurality of regression vectors, b^(i), and the matrix of principalcomponents, R _(t×f), need be stored in the processing systems of thetool. These matrices occupy a relatively small amount of memory,especially compared to the plurality of calibration spectra, and may bereadily manipulated by most existing borehole tool processing systems,allowing chemical analyses to be made in the field while sampling. Thereare many ways to determine a pseudo-inverse, such as by multiple linearregression, which expresses the pseudo-inverse of R _(t×f) as (R _(t×f)^(T) R _(t×f))⁻¹ R _(t×f) ^(T). In this case, y^(i) may be expressed as:

y ^(i) _(1×1) =b ^(i) _(1×f)( R _(t×f) ^(T) R _(t×f))⁻¹ R _(t×f) ^(T) M_(t×1).

[0047] Using this formulation, a principal component regression wasapplied to the spectra of three known formation fluid mixtures, whichwere analyzed to determine the concentrations (mole %) of fivecompounds—methane, ethane, C₃₋₅ alkanes, C₆₊ alkanes, and carbondioxide. Sample 1 resembles a typical dry gas mixture; Sample 2resembles a typical gas condensate; and Sample 3 resembles a heavier gascondensate with carbon dioxide. The measured spectra were taken at about100° C. and about 8000 psi pressure to simulate certain downholeconditions using seven wavelength channels (t=7). Negative concentrationresults were set to zero. Table 2 displays the results. The calculatedconcentrations generally show good agreement with the known values.TABLE 2 Known and Calculated Compound Concentrations (mole %) Sample CH₄C₂H₆ C³⁻⁵alkanes C₆₊alkanes CO₂ 1:known 88 10 2 0 0 calculated 87 9 4 00 2:known 75 10 5 10 0 calculated 75 10 7 8 0 3: known 45 12 8 15 20calculated 43 11 9 12 24

[0048] The invention has been described herein with reference to certainexamples and embodiments. It will, however, be evident that variousmodifications and changes may be made to these embodiments withoutdeparting from the scope of the invention as set forth in the claims.

We claim:
 1. A method of providing a chemical compositional analysiswhile sampling a formation fluid in an oilfield environment comprising:extracting a formation fluid sample; transmitting near-infrared lightthrough the formation fluid sample; detecting indications ofnear-infrared absorptions from the formation fluid sample; analyzing theindications of near-infrared light absorptions; and determiningconcentrations of a plurality of compounds in the formation fluidsample, the plurality of compounds including: methane and carbondioxide.
 2. The method of claim 1, further comprising: introducing aborehole tool into a borehole; and using the borehole tool to extractthe formation fluid sample into a measurement cell housed within thetool, wherein near-infrared light is transmitted through the measurementcell and indications of near-infrared absorption are detected from themeasurement cell.
 3. The method of claim 1, wherein the indications ofnear-infrared absorption are detected from the formation fluid sample ata pressure greater than about 1000 psi.
 4. The method of claim 1,wherein the indications of near-infrared absorptions are detected at aplurality of wavelength channels.
 5. The method of claim 1, whereinanalyzing the indications of near-infrared absorptions comprisesapplying a principal component regression model to the indications ofnear-infrared absorptions.
 6. The method of claim 5, wherein theprincipal component regression model is based on Beer's law.
 7. Themethod of claim 5, wherein the principal component regression model isbased on inverse Beer's law.
 8. The method of claim 5, wherein theprincipal component regression model is established before sampling theformation fluid in the oilfield environment and establishing theprincipal component regression model comprises: constructing acalibration data matrix from a plurality of near-infrared absorptionspectra of calibration samples; determining the principal components ofthe calibration data matrix; decomposing the calibration data matrixinto a matrix of the principal components and a matrix of scores for theplurality of calibration spectra; and determining a plurality ofregression vectors, each of which relates concentration of a constituentcompound in the calibration samples to the matrix of scores.
 9. Themethod of claim 8, wherein indications of near-infrared absorption aredetected at a plurality of wavelength channels.
 10. The method of claim9, wherein the wavelength channels are selected based on the varianceamong the principal components.
 11. The method of claim 1, wherein theplurality of compounds further includes a higher hydrocarbon selectedfrom the group consisting of: ethane, C₃₋₅ alkanes, and C₆₊ alkanes. 12.A method of providing a chemical compositional analysis while sampling aformation fluid in an oilfield environment comprising: extracting theformation fluid sample; transmitting near-infrared light through theformation fluid sample; detecting indications of near-infraredabsorptions from the formation fluid sample at a plurality of wavelengthchannels; analyzing the indications of near-infrared light absorptionsusing a principal component regression model; and determiningconcentrations of a plurality of compounds in the formation fluidsample.
 13. The method of claim 12, wherein the number of wavelengthchannels is fewer than
 10. 14. The method of claim 12, wherein theindications of near-infrared absorptions are detected using a pluralityof filters, each filter transmitting a band of near-infrared lightcentered at one of the wavelength channels.
 15. The method of claim 12,wherein the plurality of wavelength channels is selected based upon thevariance among the principal components.
 16. The method of claim 12,wherein the principal component regression model is based on Beer's law.17. The methods of claim 12, wherein the principal component regressionmodel is based on inverse Beer's law.
 18. The method of claim 12,wherein the principal component regression model is established beforesampling the formation fluid in the oilfield environment andestablishing the principal component regression model comprises:constructing a calibration data matrix from a plurality of near-infraredabsorption spectra of calibration samples; determining the principalcomponents of the calibration data matrix; decomposing the calibrationdata matrix into a matrix of the principal components and a matrix ofscores for each of the plurality of calibration spectra; and determininga plurality of regression vectors, each of which relates concentrationof a constituent compound in the calibration samples to the matrix ofscores.
 19. The method of claim 18, wherein determining each regressionvector comprises fitting the concentration of the constituent compoundto the scores for each of the calibration spectra.
 20. The method ofclaim 18, wherein determining the plurality of regression vectorscomprises calculating an inverse matrix of the regression vectors. 21.The method of claim 18, wherein applying the principal componentregression model to the indications of near-infrared absorptionscomprises calculating a pseudo-inverse of the principal componentsmatrix and applying the pseudo-inverse and then one of the regressionvectors to a vector of the indications of near-infrared absorptions. 22.The method of claim 12, wherein the plurality of compounds whoseconcentrations are determined includes: methane and carbon dioxide. 23.The method of claim 12, wherein the plurality of compounds whoseconcentrations are determined includes: methane, a higher hydrocarbon,and carbon dioxide.
 24. The method of claim 23, wherein the higherhydrocarbon includes: C₂H₆, C₃₋₅ alkanes, and C₆₊ alkanes.
 25. Anoptical fluid analysis module adapted to be housed within a boreholetool comprising: means for transmitting near-infrared light through aformation fluid sample; means for detecting indications of near-infraredabsorptions from the sample; and means for analyzing the indications ofnear-infrared absorptions to determine concentrations of a plurality ofcompounds in the sample including methane, carbon dioxide, and a higherhydrocarbon.
 26. The module of claim 25, wherein the means for detectingindications of near-infrared absorptions comprises a detector and aplurality of filters.
 27. The module of claim 26, wherein each filter isselected to transmit a band of near-infrared light centered at apre-selected wavelength.
 28. The module of claim 25, wherein the meansfor detecting indications of near-infrared absorptions comprise aplurality of detectors, each detector being responsive to a band ofnear-infrared light centered at a pre-selected wavelength.
 29. Themodule of claim 25, wherein the means for analyzing the indications ofnear-infrared absorptions includes a processor and memory means coupledwith the processor, the processor being programmed with instructionswhich, when executed by the processor, cause the processor to apply aprincipal components regression model to the indications ofnear-infrared absorptions.
 30. The module of claim 29, wherein theprincipal component regression model is established by: constructing acalibration data matrix from a plurality of near-infrared absorptionspectra of calibration samples; determining the principal components ofthe calibration data matrix; decomposing the calibration data matrixinto a matrix of the principal components and a matrix of scores foreach of the plurality of calibration spectra; and determining aplurality of regression vectors, each of which relates concentration ofa constituent compound in the calibration samples to the matrix ofscores, and wherein the memory means store information about theprincipal components and the plurality of regression vectors.
 31. Aborehole tool comprising: means for extracting a formation fluid samplefrom a subsurface region into the tool; an optical analyzer housedwithin the tool, the optical analyzer including: means for transmittingnear-infrared light through the sample, means for detecting indicationsof near-infrared absorptions from the sample, and means for analyzingthe indications of near-infrared absorptions to determine concentrationsof a plurality of compounds in the sample, including methane, carbondioxide, and at least one higher hydrocarbon; and means for divertingthe formation fluid sample into the optical analyzer.